﻿using System;
using System.Collections.Generic;
using System.Text;

namespace delegateTest
{
    class primeOut
    {
        static void Main(string[] args)
        {
            List<int> primes = new List<int>();
            Console.WriteLine("请输入一个正整数：");
            int inNumber = Int32.Parse(Console.ReadLine());
            int start;
            for (start = 2; start < inNumber; start++)
            {
                while (inNumber % start == 0)
                {
                    primes.Add(start);
                    inNumber = inNumber / start;
                }
            }
            Console.WriteLine("您输入的整数的所有素数因子是：");
            foreach (int prime in primes)
            {
                Console.WriteLine(prime);
            }
        }
}
}
